<%@ page import="com.scalar.chiptrack.utils.ConfigManager,
                 com.scalar.chiptrack.commons.Constants,org.apache.struts.util.LabelValueBean" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>

<chiptrack:checkLogon sourcePage="/dieBankReport.do" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext(); try{%>

<html>
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252">
    <LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel="stylesheet">
</HEAD>
<BODY bgColor="#ffffff" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" >
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<SCRIPT language="JavaScript">

var dateElement = "";
function openCalendar(dateValue)
{
    dateElement = dateValue;
    newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
    newWindow.moveTo(550,180);
    newWindow.focus();
}

function assignDate(passedValue)
{
    dateElement.value=passedValue;
    window.focus();
}

function validateFromAndToDates()
{
    var formdoc = document.programReleaseYieldReportForm;
    errMsg = '';

    var pa	= document.getElementById("errors")

    if(chkDate(formdoc.fromDate.value,'From Date','N') == false)
    {
        pa.innerHTML = errMsg;
        formdoc.fromDate.focus();
        return false;
    }

    if(chkDate(formdoc.toDate.value,'To Date','N') == false)
    {
        pa.innerHTML = errMsg;
        formdoc.toDate.focus();
        return false;
    }

    if(formdoc.fromDate.value!='' && formdoc.toDate.value!='')
    {
        if (!validateDateOut(formatDateAsMMDDYYYY(formdoc.fromDate.value),formatDateAsMMDDYYYY(formdoc.toDate.value)))
        {
            pa.innerHTML = "<li>To Date cannot be less than From Date";
            formdoc.toDate.focus();
            return false;
        }
    }
    return true;
}

function submitPage()
{
    var d = new Date();
    var day = d.getDate();
    var month = d.getMonth()+1;
    var year = d.getFullYear();
    var hour = d.getHours();
    var min = d.getMinutes();
    var sec = d.getSeconds();
    var form = document.programReleaseYieldReportForm;
    var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;
    var reporttype        = "";
    var errorObj =  document.getElementById("errors")
    errorObj.innerHTML = '';

    var success;
    success = true;
    success = validateFromAndToDates();
    if(success == false)
    {
       return false;
    }
    form.prompt0.value  = document.programReleaseYieldReportForm.baseProductId.value;
    form.prompt1.value  = document.programReleaseYieldReportForm.productId.value;
    form.prompt2.value  = document.programReleaseYieldReportForm.vendorId.value;
    if( document.programReleaseYieldReportForm.fromDate.value == '' || document.programReleaseYieldReportForm.fromDate.value.length < 0 )
    {
        form.prompt3.value  = '0';
    }
    else
    {
        form.prompt3.value  = document.programReleaseYieldReportForm.fromDate.value;
    }
    if( document.programReleaseYieldReportForm.toDate.value == '' || document.programReleaseYieldReportForm.toDate.value.length < 0 )
    {
       form.prompt4.value  = '0';
    }
    else
    {
        form.prompt4.value  = document.programReleaseYieldReportForm.toDate.value;
    }
    form.prompt5.value  = defaultPrompt;
    form.prompt6.value  = '';
    form.prompt7.value  = '';
    form.prompt8.value  = '';
    form.prompt9.value  = '';
    form.prompt10.value = '';

    form.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Engineering/Program_Release_Yield_Report.rpt";
}

</script>
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->
<TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
  <TBODY >
  <TR>
    <TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

    <!-- Side Navigation start -->
    <%@include file="/jsp/engineering/engg_report_menu.jsp" %>
    <!-- end of the side navigations -->

    <TD bgcolor="#ffffff">
    <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
    <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
    <TD valign="top" width="100%">

    <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
    <BR>
    <!-- from here your body starts -->
    <html:form name="programReleaseYieldReportForm" action="/progamReleaseYieldReport" type="com.scalar.chiptrack.operations.reports.forms.ProgramReleaseYieldReportForm" onsubmit="submitPage()"method= "post">
    <input type="hidden" name="prompt0">
    <input type="hidden" name="prompt1">
    <input type="hidden" name="prompt2">
    <input type="hidden" name="prompt3">
    <input type="hidden" name="prompt4">
    <input type="hidden" name="prompt5">
    <input type="hidden" name="prompt6">
    <input type="hidden" name="prompt7">
    <input type="hidden" name="prompt8">
    <input type="hidden" name="prompt9">
    <input type="hidden" name="prompt10">

    <TABLE width='75%' align=center cellpadding='3' cellspacing='2' border='0' bordercolor='black'>
            <TR><Td colspan='4' class="NArialW" align=center>Programming Yield Report</td></tr>
            <TR><TD colspan='4'><IMG src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height='10'></TD></TR>
            <tr><td colspan='4' align="left" class='NArialL'>&nbsp;<FONT id="errors" color='FF0000'></font></td></tr>
            <TR><TD colspan='4' id="chiptracErrors"><chiptrack:errors styleClass="NArialL"/></TD></TR>
            <TR><TD colspan='4'><chiptrack:info styleClass="NArialL"/></TD></TR>
            <tr>
                <td width="15%" class="NArialL" nowrap>Base Product </td>
                <td width="25%" class="NArialL">
                    <html:select name="programReleaseYieldReportForm" property="baseProductId" styleClass="txfield" onchange='document.programReleaseYieldReportForm.submit()'>
                        <html:option value="0">All Base Products</html:option>
                        <html:options collection="baseProductList" property="value" labelProperty="label"/>
                     </html:select>
                </td>
                <td width="15%" class="NArialL">Product </td>
                <td width="25%" class="NArialL">
                    <html:select name="programReleaseYieldReportForm" property="productId" styleClass="txfield">
                        <html:option value="0">All Products</html:option>
                        <html:options collection="productList" property="value" labelProperty="label"/>
                     </html:select>
                </td>
            </tr>
            <tr>
                <td width="15%" class="NArialL">Vendor</td>
                <td width="25%" class="NArialL">
                    <html:select name="programReleaseYieldReportForm" property="vendorId" styleClass="txfield">
                        <html:option value="0">All Vendors</html:option>
                        <html:options collection="vendorList" property="value" labelProperty="label"/>
                     </html:select>
                </td>
                <td colspan='2'>&nbsp;</td>
            </tr>

            <tr>
                <td width="15%" class="NArialL">From Date </td>
                <td width="25%" class="NArialL">
                    <html:text name="programReleaseYieldReportForm" property="fromDate" size="20" styleClass="txfield"/>
                    <a href="javascript:openCalendar(document.programReleaseYieldReportForm.fromDate)"onmouseover="window.status='Click to Select From Date';return true"onmouseout="window.status='';return true" title="Click here to Select From Date">
                    <img border="0" src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=18 width=18/></a>
                </td>
                <td width="15%" class="NArialL">To Date</td>
                <td width="25%" class="NArialL">
                    <html:text name="programReleaseYieldReportForm" property="toDate" size="20" styleClass="txfield"/>
                    <a href="javascript:openCalendar(document.programReleaseYieldReportForm.toDate)"onmouseover="window.status='Click to Select To Date';return true"onmouseout="window.status='';return true" title="Click here to Select To Date">
                    <img border="0" src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=18 width=18/></a>
                </td>
            </tr>

            <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
            <tr>
                <td width="70%" colspan=5 align="center">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <input type="image" onClick="javascript:return submitPage();"  border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17" onmouseover="window.status='Click to Generate Report';return true"onmouseout="window.status='';return true"title="Click here to Generate Report">
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="javascript:document.yieldGraphReportForm.reset();"><img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true"title="Click here to Reset"></a>
                </td>
            </tr>
 </table>
 </html:form>
 <!-- till here -->
 <BR><BR>
 </TD><TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD></TR>
 </TABLE>
 <!-- Footer starts here -->
 <%@ include file="/jsp/includes/footer.jsp" %>
 <!-- footer end here -->
</body>
</html>

<%}catch(Exception e ){e.printStackTrace() ;}%>

